<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>
    
</body>
</html>
<script>
    // [1,2,5,4,3,1,6,7,3]
    // 数组排重 
    var arr = [1,2,5,4,3,1,6,7,3];
    for(var i = 0 ; i<arr.length;i++){
        for(var j = 1;j<arr.length;j++){
            if(arr[i]==arr[j]&&i!=j){
                arr.splice(j,1);
            }
        }
    }
    console.log(arr);
</script>
<script>
    var num =[];
    var arr = [1,2,5,4,3,1,6,7,3];
    arr.sort();
    // console.log(arr);
    for(var i = 0 ; i<arr.length;i++){
        if(arr[i]!==arr[i+1]){
            num.push(arr[i])
        }
    }
    console.log(num);
</script>

<script>
    // [1.8,1.7,3,1.2] 对数组进行排序然后找到最大值和最小值
    var arr = [1.8,1.7,3,1.2];
    arr.sort(function(a,b){
        return a - b;
    }); 
    console.log(arr);
    console.log(arr[0]);
    console.log(arr[3]);
</script>
<script>
    var a3 = 0;
    var arr = [1.8,1.7,3,1.2];
    for(var a1 = 0;a1<arr.length;a1++){
        for(var a2 = a1;a2<arr.length;a2++){
            if(arr[a1]>arr[a2]&&a1!=a2){
            a3 = arr[a1];
            arr[a1] = arr[a2];
            arr[a2] = a3;
            }
            
        }
    }
    console.log(arr);
</script>